\documentclass[10pt,oneside]{book}

\input{macros_orig.tex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\pagestyle{empty}
\thispagestyle{empty}

\begin{codebox}
  \Procname{$\proc{k-means}(k, \tau, \{x^{(i)}\}_{i=1}^n)$}
  \li $\mu, y \gets $ randinit
  \li \For $t \gets 1$ \To $\tau$
  \li   \Do
         $y_{\texttt{old}} = y$
  \li        \For $i \gets 1$ \To $n$
  \li       \Do
             $y^{(i)} = \arg\min_j \left\Vert x^{(i)} - \mu^{(j)} \right\Vert_2^2$
            \End
  \li    \For $j \gets 1$ \To $k$
  \li       \Do 
             $\mu^{(j)} = \frac{1}{N_j} \sum_{i=1}^n 1(y^{(i)} = j) x^{(i)}$
            \End
  \li      \If $1(y = y_{\texttt{old}})$
  \li          \Then
		  break \label{alg:termination}
      \End
      \End
  \li \Return $\mu, y$
\end{codebox}

\end{document}
